AWS Network Load Balancer vs Classic Load Balancer

January 31, 2022

If you're migrating to the cloud or starting with AWS, you may be wondering about the best load balancing option for your applications. Enter the Network Load Balancer (NLB) and Classic Load Balancer (CLB). These two AWS services share a common goal, but differ greatly in their configuration, features, and pricing. This comparison will help you choose which one to use and why.

What are Load Balancers?

Before getting into the specifics of AWS Load Balancers, let's define what Load Balancers are. They are devices or software that distribute incoming network traffic across multiple servers, instances, or containers to ensure availability, scalability, and performance. Load Balancers act as entry points to your applications, handling all the incoming requests, and then forwarding them to the suitable servers to process them.

Classic Load Balancer (CLB)

CLB is the oldest and simplest form of AWS Load Balancers. It provides Layer 4 (Transport Layer) and Layer 7 (Application Layer) load balancing options, meaning it can distribute traffic based on IP addresses, Ports, Protocols, and Content. Some of the benefits of Classic Load Balancer:

  • Provides health checks for EC2 instances.
  • Supports Sticky Sessions persisting Session information for clients.
  • Configurable with Amazon CloudWatch Metrics
  • Has no restriction on the number of availability zones.

On the downside, AWS Classic Load Balancer only supports up to 5,000 connections per seconds and has a hard limit of 60,000 active and inactive listeners. Plus, it requires an ElasticIP address to be assigned to it, which constitutes an extra expense.

Network Load Balancer (NLB)

The Network Load Balancer (NLB) is a newer and more advanced form of the AWS Load Balancer. It provides ultra-high throughput, low latency, and scalable Load Balancing that can handle millions of requests per second.

NLB offers Layer 4 load balancing, distributing traffic based on IP addresses, Ports, and Protocols. Some of the benefits of Network Load Balancer:

  • Supports TCP, UDP, and TLS traffic.
  • Automatically scales to manage traffic across multiple Availability Zones.
  • Not charged per hour but per Load Balancer-hour.
  • Supports static IP allocation.

The major downside of the Network Load Balancer is that it does not support content-based routing (Layer 7), and it does not offer Sticky Sessions by default. But there are ways to configure it with Lambda functions or IP-based routing to replicate the CLB's behavior.

Comparison

Features Classic Load Balancer Network Load Balancer
Layer 4/ Layer 7 LB Yes Layer 4 only
Maximum Connections 5000 1 Million
Static IP/ Elastic IP Elastic IP Static IP
Target Health Checking Yes Yes
Sticky Sessions Yes No
Scaling Manual Scaling Auto Scaling
Pricing Per Hour + Data Per NLB-Hour+ Data
Platform HTTP/HTTPS/SSL TCP/UDP/TLS

Conclusion

Both Classic Load Balancer and Network Load Balancer have their pros and cons. CLB is an excellent choice if you want to use Layer 7 Routing, Sticky Sessions, or support multiple protocols (HTTP, HTTPS, SSL), while NLB is an excellent choice if you want to handle high traffic volumes, low latency, and TCP/UDP/TLS traffic.

Keep in mind that AWS offers an Application Load Balancer as well, which provides advanced Layer 7 routing features, content-based routing, and Sticky Sessions. If you are looking for a more advanced but cost-effective option, it might be the best choice.

To sum up, choosing the right Load Balancer depends on your specific use case and technical requirements. You should evaluate your traffic patterns, scalability goals, and budget before deciding. Whichever Load Balancer you choose, be sure to configure it for proper health checks, security groups, and scaling policies to ensure application availability, performance, and resiliency.

References


© 2023 Flare Compare